#include <cstdio>
#include <cstring>

double f[ 100006 ];
int d[ 100006 ];

int main( )
{
    int n, m, i, j, u, v;
    while ( scanf("%d%d", &n, &m) != EOF )
    {
        if ( n == 0 && m == 0 ) break;
        memset( f, 0, sizeof( f ) );
        memset( d, -1, sizeof( d ) );
        for ( i = 0; i < m; i++ )
        {
            scanf("%d%d", &u, &v);
            d[ u ] = v;
        }
        for ( i = n - 1; i >= 0; i-- )
            if ( d[ i ] != -1 )
                f[ i ] = f[ d[ i ] ];
            else
            {
                f[ i ] = 1;
                for ( j = 1; j <= 6; j++ )
                    f[ i ] += f[ i + j ] / 6;
            }
        printf("%.4lf\n", f[ 0 ]);
    }
    return 0;
}
